/**
 * 
 */
package com.example.miaosha1.vo;

/**
 * @author yufc
 *
 */
public class ResponseResult<T> {
	
	private int code;
	private String msg;
	private T data;
	
	private ResponseResult (T data){
		this.code = 0;
		this.msg = "success";
		this.data = data;
	}
	
	private ResponseResult(CodeMsg codeMsg) {
		if(codeMsg == null) {
			return;
		}
		
		this.code = codeMsg.getCode();
		this.msg = codeMsg.getMsg();
	}

	public static <T> ResponseResult<T> success(T data){
		return new ResponseResult<T>(data);
		
	}
	
	public static <T> ResponseResult<T> error(CodeMsg codeMsg){
		return new ResponseResult<T>(codeMsg);
	}

	
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}
	
	

}
